<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<% String basePath = request.getContextPath(); %>
<head>
<base href="<%=request.getContextPath()%>/" />
<script> 
window.jQuery || document.write('<script src="http://kiwenlau.com/js/jquery.min.js"><\/script>')
</script>
<title>后台管理系统</title>
<script type="text/javascript" src="js/ajaxfileupload.js"></script>
<script type="text/javascript" src="js/jquery-2.1.1.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="Styles/bootstrap.min.css" />
</head>
<body>
<h2>退回公文修改</h2>  
        <form role="form" id="uploadForm" name="from" method="post">
         <input style="display:none;" class="form-control" id="gongwenid" value="${changegw.gwId}">
        <div class="form-group">
        <label for="name">标题：
         <input type="text" class="form-control" id="title" value="${changegw.title}">
         </label>
         </div>
		 <c:if test="${changegw.grade==1}"><p>常规公文</p></c:if>
         <c:if test="${changegw.grade==2}"><p>重要公文</p></c:if>
         <c:if test="${changegw.grade==3}"><p>特殊公文</p></c:if>
         <c:if test="${changegw.grade==4}"><p>紧急公文</p></c:if>
		
		<br/>
		<label>公文内容:
		<textarea id="content" class="ckeditor"  name="content" value="${changegw.content}">${changegw.content}</textarea>
		</label><br/>
		${gw.audit}:
		<c:if test="${changegw.agree==0}">不通过</c:if><c:if test="${changegw.agree==1}">通过</c:if>
		
		 <input type="file" id="file" name="myfile" />
        <input type="button" value="上传"  onclick="doUpload()"/> 
        <progress id="progressBar" value="0" max="100"></progress>
        <span id="percentage"></span>
        <input id="sp_AjaxFile" name="sp_AjaxFile" value="${changegw.gwAddress}"/><br/>
        <div class="center-block" style="width:200px;">
         <div class="form-group" style="text-align:center;">
        <div class="center-block" style="width:200px;display:inline-block;">
		<input type="button" value="再次提交" class="btn btn-default" onclick="from1()"/>
		<a role="button" class="button red" id="${changegw.gwId}" onclick="deletes(${changegw.gwId})">删除</a>
		</div>
		</div>
		</div>
		<%--  <a href="download?filename=${requestScope.user.image.originalFilename}">
       ${requestScope.user.image.originalFilename }
       </a> --%>
	</form>
</body>
<script type="text/javascript">

function deletes(gwId){
	var bool = window.confirm("确定删除吗"+gwId);
	if (bool){
		var  id = $("#gongwenid").val();
		 $.post("gongwen/delete.do",{id:id},
		function(data,status){
			 if("success"==data){
				 alert("提交成功！")
				 var aTag = document.getElementById(gwId);
					aTag.href = "gongwen/lookgw";

				 }else{
					 alert("删除失败");
				 }
		});
	}
	}

 function from1(){
	 var  id = $("#gongwenid").val();
	 var  title = $("#title").val();
	 var  content =CKEDITOR.instances.content.getData();
	 $.post("gongwen/xiugai",{title:title,content:content,id:id},
	 function(data,status){
	 if("success"==data){
		 alert("提交成功！")
		 window.location.href="gongwen/lookgw";
	 }else{
	 alert("保存失败！");
	 }
	 });
	}
 function doUpload(){
	 alert("不支持修改上传文件，请写新公文！");
	 }
</script>
</html>